using UnityEngine;
using System.Collections;

public class MovimientoFlama : MonoBehaviour {
	
	private int timeToMove = 350;
	private float rightX = 17.4638f;
	private float leftX = 2.523351f;
	public bool goRight;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if(timeToMove == 0){
			if(!goRight){
				transform.position +=new Vector3(-0.2f,0,0);
				if(transform.position.x <= leftX){
					timeToMove = 350;
					goRight = true;
				}
			}else{
				transform.position +=new Vector3(0.2f,0,0);
				if(transform.position.x >= rightX){
					timeToMove = 350;
					goRight = false;
				}
			}
		}else{
			timeToMove--;
		}
	
	}
}
